<template>
    <div class="model" v-if="isShow">
        <div class="title">{{ title }}</div>
        <div class="content">{{ content }}</div>
        <div class="btn">
            <button class="cancel" @click="cancel">取消</button>
            <button class="confirm" @click="confirm">确定</button>
        </div>
    </div>
</template>

<script setup>
defineProps({
    title: {
        type: String,
        default: '标题'
    },
    content: {
        type: String,
        default: '内容'
    },
    isShow: {
        type: Boolean,
        default: false
    }
})

//取消删除
const cancel = () => {
    emits('cancel')
}

//确定删除
const confirm = () => {
    emits('confirm')
}

//传给父组件的方法名称
const emits = defineEmits([
    'cancel', 'confirm'
])
</script>

<style>
.model {
    width: 500px;
    height: 300px;
    position: fixed;
    border-radius: 5%;
    top: 30%;
    left: 35%;
    background-color: aquamarine;
    text-align: center;
    padding: 80px;
    box-sizing: border-box;
}

.title {
    margin-bottom: 10px;
}

.btn {
    display: flex;
    justify-content: space-evenly;
    margin-top: 80px
}
</style>
